<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>批量添加货位</title>
</head>

<body>
<div  style="padding: 10px;">

    <div class="panel panel-default">
        <div class="panel-heading">正在操作：批量添加货位</div>
        <div class="panel-body">

            <form id="shelfBatch_form" onsubmit="return false;" class="form-horizontal" >

                <div class="form-group">
                    <label for="storeID" class="col-sm-2 control-label">选择仓库 <font color="red">*</font></label>
                    <div class="col-sm-10">
                        <select class="form-control col-sm-2" id='storeID' name='storeID' style="width: 200px;">
                            <option value=''>请选择</option>
                            <!--{foreach from=$store_array item=value}-->
                            <option value='<!--{$value->storeID}-->'<!--{if $storeID == $value->storeID}--> selected <!--{/if}--> ><!--{$value->storeName}--></option>
                            <!--{/foreach}-->
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="prefix" class="col-sm-2 control-label">前缀 <font color="red">*</font></label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="prefix" id="prefix" style="width:200px;" value="">
                    </div>
                </div>

                <div class="form-group">
                    <label for="suffix" class="col-sm-2 control-label">后缀 <font color="red">*</font></label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="suffix" id="suffix" style="width:200px;" value="">
                    </div>
                </div>

                <div class="form-group">
                    <label for="number" class="col-sm-2 control-label">累加次数 <font color="red">*</font></label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="number" id="number" style="width:200px;" value="">
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type="button" class="btn btn-primary" onclick="shelfBatch.check();" value="保存" />&nbsp;&nbsp;
                        <input type="button" class="btn btn-warning" onclick="E.closeWindows();" value="关闭" />
                    </div>
                </div>

            </form>

        </div>
    </div>




</div>

<script type="text/javascript">

    $().ready(function(){
        $("#prefix").focus();
    })

    var shelfBatch = {

        dt: "",

        check: function() {

            this.dt = E.getFormValues("shelfBatch_form");
            var error_msg = "";

            if (this.dt.storeID == ""){
                error_msg += "仓库不能为空<br />";
            }

            if (this.dt.prefix == ""){
                error_msg += "前缀不能为空<br />";
            }

            if (this.dt.number == ""){
                error_msg += "累加次数不能为空<br />";
            }else{

                if( !E.isInt( this.dt.number ) )
                    error_msg += "累加次数只能为整数数字<br />";
            }

            if (error_msg != "")
                E.alert(error_msg);
            else {
                this.add();
            }

        },

        add: function() {
            $.ajax({
                type: "POST",
                url: "/invokingAjax-backend/wms/storeShelf.ajax?operFlg=10",
                dataType: "JSON",
                data: this.dt,
                success: function( result_obj ) {
                    if (result_obj.code == 200) {

                        E.opener("storeShelf.load");

                        E.alert(result_obj.message , 2 , "E.closeWindows()");


                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
        }

    };


</script>

</body>

</html>
